package ru.elifantiev.cityrouter.infrastructure.adapters;

import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class AdapterWrapper extends BaseAdapter {

    protected BaseAdapter wrappedOne;

    public AdapterWrapper(BaseAdapter wrappedOne) {
        super();
        this.wrappedOne = wrappedOne;
        wrappedOne.registerDataSetObserver(new DataSetObserver() {
            @Override
            public void onChanged() {
                notifyDataSetChanged();
            }

            @Override
            public void onInvalidated() {
                notifyDataSetInvalidated();
            }
        });
    }

    @Override
    public boolean areAllItemsEnabled() {
        return wrappedOne.areAllItemsEnabled();
    }

    @Override
    public View getDropDownView(int position, View convertView, ViewGroup parent) {
        return wrappedOne.getDropDownView(position, convertView, parent);
    }

    @Override
    public int getViewTypeCount() {
        return wrappedOne.getViewTypeCount();
    }

    @Override
    public int getItemViewType(int position) {
        return wrappedOne.getItemViewType(position);
    }

    @Override
    public boolean isEmpty() {
        return wrappedOne.isEmpty();
    }

    @Override
    public boolean isEnabled(int position) {
        return wrappedOne.isEnabled(position);
    }

    @Override
    public boolean hasStableIds() {
        return wrappedOne.hasStableIds();
    }

    public int getCount() {
        return wrappedOne.getCount();
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        return wrappedOne.getView(i, view, viewGroup);
    }

    public Object getItem(int i) {
        return wrappedOne.getItem(i);
    }

    public long getItemId(int i) {
        return wrappedOne.getItemId(i);
    }

    public BaseAdapter getWrappedAdapter() {
        return wrappedOne;
    }
}
